﻿using Common;

namespace TeamIce
{
	public enum MoveType
    {
        Unknown,
        Pass,
        Shoot,
        Move,
		Drop
    }

    public class Move
    {
        public MoveType Type;
        public Vector Target;
        public int Score;
        public int Strength;
    	public readonly PlayerEx PassTo;

    	public Move(MoveType type, Vector target, int strength, int score)
    	{
			PassTo = null;
    		Type = type;
    		Target = target;
    		Strength = strength;
    		Score = score;
    	}

		public Move(PlayerEx passTo, Vector target, int strength, int score)
			:this(MoveType.Pass, target, strength, score)
		{
			PassTo = passTo;
		}

        public void Make(Player player)
        {
            switch (Type)
            {
                case MoveType.Pass:
                case MoveType.Shoot:
                    player.ActionShoot(Target, Strength);
                    break;
                case MoveType.Move:
                    player.ActionGo(Target);
                    break;
				case MoveType.Drop:
					player.ActionDropBall();
#if LOG
					Logger.Log("DROP BALL");
#endif
            		break;
            }
        }

		public static int CompareByScoreDesc(Move m1, Move m2)
		{
			if (m1.Score < m2.Score) return 1;
			if (m1.Score > m2.Score) return -1;
			return 0;
		}
    }
}
